package com.zimin.cloud.system.controller.api;


import com.zimin.authorize.annotation.Authorize;
import com.zimin.cloud.mine.pojo.system.business.MenuBO;
import com.zimin.shared.annotation.OpLog;
import com.zimin.shared.enums.ModuleEnum;
import com.zimin.shared.pojo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 菜单权限 前端控制器 接口
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:05
 */
@RequestMapping("/sys/menu")
@Api(value = "菜单管理API", tags = {"菜单管理API"})
public interface IMenuController {


    /**
     * <p>查询左侧菜单树</p>
     *
     * @param menuBO 查询参数
     * @return com.zimin.shared.pojo.Result
     * @since 2022-02-13 10:38:12
     */
    @GetMapping("/routes")
    @Authorize(hasPerMi = "system:menu:routes")
    @OpLog(module = ModuleEnum.SYSTEM, action = "查询左侧菜单树")
    Result routes(MenuBO menuBO);

    /**
     * 菜单管理
     */
    @GetMapping("/allRoutes")
    @Authorize(hasPerMi = "system:menu:allRoutes")
    @OpLog(module = ModuleEnum.SYSTEM, action = "菜单管理")
    @ApiOperation(value = "菜单管理", notes = "菜单管理", httpMethod = "GET")
    Result allRoutes(MenuBO menuBo);

    /**
     * 新增菜单
     */
    @PostMapping
    @Authorize(hasPerMi = "system:menu:save")
    @OpLog(module = ModuleEnum.SYSTEM, action = "新增菜单")
    @ApiOperation(value = "新增菜单", notes = "新增菜单", httpMethod = "POST")
    Result save(@RequestBody  MenuBO menuBO);

    /**
     * 更新菜单
     */
    @PutMapping
    @Authorize(hasPerMi = "system:menu:update")
    @OpLog(module = ModuleEnum.SYSTEM, action = "更新菜单")
    @ApiOperation(value = "更新菜单", notes = "更新菜单", httpMethod = "PUT")
    Result update(@RequestBody  MenuBO menuBO);

    /**
     * 根据ID批量删除
     */
    @DeleteMapping
    @Authorize(hasPerMi = "system:menu:delete")
    @OpLog(module = ModuleEnum.SYSTEM, action = "批量删除菜单")
    @ApiOperation(value = "批量删除菜单", notes = "批量删除菜单", httpMethod = "DELETE")
    Result delete(@RequestParam(value = "idList") List<String> idList);

}
